/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package newpackage;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.codehaus.jackson.annotate.JsonIgnore;

/**
 *
 * @author Juan
 */
@Entity
@Table(name = "RESPONSABLE")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Responsable.findAll", query = "SELECT r FROM Responsable r"),
    @NamedQuery(name = "Responsable.findByCodResponsable", query = "SELECT r FROM Responsable r WHERE r.codResponsable = :codResponsable"),
    @NamedQuery(name = "Responsable.findByDescripcion", query = "SELECT r FROM Responsable r WHERE r.descripcion = :descripcion")})
public class Responsable implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "CodResponsable")
    private Integer codResponsable;
    @Column(name = "Descripcion")
    private String descripcion;
    @OneToMany(mappedBy = "codResponsable")
    private Collection<Proceso> procesoCollection;

    public Responsable() {
    }

    public Responsable(Integer codResponsable) {
        this.codResponsable = codResponsable;
    }

    public Integer getCodResponsable() {
        return codResponsable;
    }

    public void setCodResponsable(Integer codResponsable) {
        this.codResponsable = codResponsable;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    @XmlTransient
    @JsonIgnore
    public Collection<Proceso> getProcesoCollection() {
        return procesoCollection;
    }

    public void setProcesoCollection(Collection<Proceso> procesoCollection) {
        this.procesoCollection = procesoCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codResponsable != null ? codResponsable.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Responsable)) {
            return false;
        }
        Responsable other = (Responsable) object;
        if ((this.codResponsable == null && other.codResponsable != null) || (this.codResponsable != null && !this.codResponsable.equals(other.codResponsable))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "newpackage.Responsable[ codResponsable=" + codResponsable + " ]";
    }
    
}
